package com.curso.sesion10;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class DeSer {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
		    // Deserialize from a file
		    File file = new File("filename.ser");
		    ObjectInputStream in = new ObjectInputStream(new FileInputStream(file));
		    // Deserialize the object
		    javax.swing.JButton button = (javax.swing.JButton) in.readObject();
		    in.close();

		    // Get some byte array data
		    byte[] bytes = getBytesFromFile(file);
		    // see Reading a File into a Byte Array for the implementation of this method

		    // Deserialize from a byte array
		    in = new ObjectInputStream(new ByteArrayInputStream(bytes));
		    button = (javax.swing.JButton) in.readObject();
		    in.close();
		} catch (ClassNotFoundException e) {
		} catch (IOException e) {
		}

	}

}
